package com.ybf.api.common;

public class ResultResponse {

    /**
     * 登录错误code
     */
    public static Integer LOGIN_ERROR_CODE = 600;
    /**
     * 错误code
     */
    public static Integer ERROR_CODE = 500;
    /**
     * 成功code
     */
    public static Integer OK_CODE = 200;
    /**
     * 响应代码
     */
    private Integer code;

    /**
     * 响应消息
     */
    private String message;

    /**
     * 响应结果
     */
    private Object result;

    public ResultResponse() {
    }

    public ResultResponse(Integer code, String message, Object result) {
        this.code = code;
        this.message = message;
        this.result = result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public static ResultResponse error(Integer code, String message, Object result) {
        return new ResultResponse(code, message, result);
    }

    public static ResultResponse error(String message, Object result) {
        return new ResultResponse(ResultResponse.ERROR_CODE, message, result);
    }

    public static ResultResponse error(Object result) {
        return new ResultResponse(ResultResponse.ERROR_CODE, "error", result);
    }

    public static ResultResponse ok(Integer code, String message, Object result) {
        return new ResultResponse(ResultResponse.OK_CODE, message, result);
    }

    public static ResultResponse ok(String message, Object result) {
        return new ResultResponse(ResultResponse.OK_CODE, message, result);
    }

    public static ResultResponse ok(Object result) {
        return new ResultResponse(ResultResponse.OK_CODE, "ok", result);
    }
}
